//
//  CompetionInforCell.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/7/29.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "CompetionInforCell.h"

@implementation CompetionInforCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        UIImageView *bgImageView = [[UIImageView alloc] init];
        bgImageView.backgroundColor = [UIColor redColor];
        [self addSubview:bgImageView];
        [bgImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(scaleLeftAndRight(10));
            make.right.equalTo(self.mas_right).offset(scaleLeftAndRight(-10));
            make.top.equalTo(self.mas_top).offset(scaleTopAndBottom(10));
            make.height.mas_equalTo(scaleTopAndBottom(140));
        }];
        UILabel *titleLabel = [[UILabel alloc] init];
        titleLabel.text = @"2018王者荣耀总决赛";
        titleLabel.backgroundColor = [UIColor cyanColor];
        [self addSubview:titleLabel];
        [titleLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(scaleLeftAndRight(10));
            make.right.equalTo(self.mas_right).offset(scaleLeftAndRight(-10));
            make.top.equalTo(bgImageView.mas_bottom).offset(scaleTopAndBottom(10));
            make.height.mas_equalTo(scaleTopAndBottom(20));
        }];
        UILabel *timeLabel = [[UILabel alloc] init];
        timeLabel.text = @"倒计时:2天";
        timeLabel.backgroundColor = [UIColor redColor];
        [self addSubview:timeLabel];
        [timeLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(scaleLeftAndRight(10));
            
            make.top.equalTo(titleLabel.mas_bottom).offset(scaleTopAndBottom(10));
            make.height.mas_equalTo(scaleTopAndBottom(20));
        }];
        UILabel *countLabel = [[UILabel alloc] init];
        countLabel.text = @"报名人数:21279";
        countLabel.backgroundColor = [UIColor greenColor];
        [self addSubview:countLabel];
        [countLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.mas_right).offset(scaleLeftAndRight(-10));
            make.top.equalTo(titleLabel.mas_bottom).offset(scaleTopAndBottom(10));
            make.height.mas_equalTo(scaleTopAndBottom(20));
            make.left.equalTo(timeLabel.mas_right);
            make.width.equalTo(timeLabel.mas_width);
        }];
        UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
        button.backgroundColor = [UIColor yellowColor];
        [self addSubview:button];
        [button mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.mas_left).offset(scaleLeftAndRight(10));
            
            make.top.equalTo(timeLabel.mas_bottom).offset(scaleTopAndBottom(10));
            make.height.mas_equalTo(scaleTopAndBottom(20));
            make.width.mas_equalTo(scaleLeftAndRight(50));
        }];

    }
    return self;
}



- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
